<template>
  <div>
    <Article :article="article" v-if="article" :detail="true" @updateArticle="updateArticle" style="margin-left:3em;padding-left:2em"></Article>
  </div>
</template>

<script>
import Article from '@/components/Article';

export default {
  data() {
    return {
      article: null,
    };
  },
  mounted() {
    this.getArticle();
  },
  components: {
    Article,
  },
  methods: {
    getArticle() {
      const { id } = this.$route.params;
      this.$http.get(`articles/${id}/`).then((res) => {
        this.article = res.data;
      });
    },
    updateArticle(newArticle){
      this.article = newArticle
    }
  },
};
</script>

<style>
</style>
